﻿using System;
using System.Collections.Generic;
using System.Text;

namespace EnCor.Logging
{
    public class Log4netAdaptorAssembler : LoggerAssembler
    {
        public override ILogger Assemble(EnCor.ObjectBuilder.IBuilderContext context, LoggerConfig objectConfiguration)
        {
            Log4netAdaptorConfig config = objectConfiguration as Log4netAdaptorConfig;
            if (config == null)
            {
                throw new EnCor.Config.ConfigurationException(string.Format("Cannot convert {0} to Log4netAdaptorConfig.", objectConfiguration));
            }

            Log4netAdaptor logger = new Log4netAdaptor(config.Log4NetLoggerName);
            return logger;
        }
    }
}
